<!doctype html>
<jsp:directive.page import="com.cn.ccp.bean.UserBean" />
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<html>
<f:view>
<f:loadBundle var="messages" basename="messages"></f:loadBundle>
<head>
<meta charset="utf-8">
<title><h:outputText value="#{messages['system_title']}" /></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- styles -->
    <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/custom.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="../../../js/html5.js"></script>
    <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/icon/favicon.png">
	
	
	<script type="text/javascript">
	
	function valid_path(path){   
		var patrn=/^[a-zA-Z]:\\[a-zA-Z_0-9\\]*/; 
		if (!patrn.exec(path)){
		   return false;
		}    
		return true;   
	} 
	
	function checkPath(){
		var path = document.getElementById("formid:filePath").value;
		var flag = valid_path(path);
		var filePathError = document.getElementById("filePathError");
		if(!flag){
			var oInput = document.getElementById("formid:filePath");
			oInput.focus();
			filePathError.innerHTML = "不合法的路径地址，请重新填写"; 
			return false;
		}else{
			filePathError.innerHTML = "";
		}			
		return true ;
	}
	
	function checkSubmit(){
		return checkPath();
	}
	</script>
</head>

<body class="bg-white" style="overflow-x:hidden;">
<a id="viewDiv"></a>
	<h:form id="formid" styleClass="form-horizontal" style="margin-left: 20px;margin-right: 20px" onsubmit="return checkSubmit()">
		<h:inputHidden value="#{filePathAction.filePathBean.id}"></h:inputHidden>
		<div class="row page-head">
			<h3 class="page-title">
				<i class="n-icon-selection  n-icon-black"></i><h:outputText value="#{messages['course_page_title']}"/>&nbsp;&gt;&nbsp;<b><h:outputText value="#{messages['pages_file_path_title']}" /></b>
			</h3>
		</div>
		<legend>
			<h:outputText value="#{messages['basic_info']}"></h:outputText>
		</legend>
		<div class="form-white">
			<div class="control-group">
				<label class="control-label" for=""><h:outputText
						value="#{messages['pages_file_path_setting']}" />
				</label>
				<div class="controls">
					<h:inputText id="filePath" value="#{filePathAction.filePathBean.path}" required="true" onblur="checkPath(this.value)"> 
						<f:converter converterId="stringconverter"/>
					</h:inputText>
					<span class="help-inline" id="filePathError" style="color:red"><h:message for="filePath" style="color:red" /></span>
				</div>
			</div>
			
			<div class="control-group">
				<label class="control-label" for=""></label>
				<div class="controls">
					eg : c:\files
					<span class="help-inline"></span>
				</div>
			</div>
			
			<div class="control-group">
				<label class="control-label" for=""><h:outputText
						value="#{messages['pages_file_path_status']}" />
				</label>
				<div class="controls">
					<h:selectOneRadio id="flag" value="#{filePathAction.selectFlag}" >
					 	<f:selectItem itemValue="1" itemLabel="#{messages['user_page_label_status_ok']}"/>
					 	<f:selectItem itemValue="0" itemLabel="#{messages['user_page_label_status_no']}"/>
					 </h:selectOneRadio>
					<span class="help-inline"><h:message for="flag"
							style="color:red" />
					</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for=""><h:outputText
						value="#{messages['label_backup']}" />
				</label>
				<div class="controls">
					<h:inputTextarea rows="3" id="backup" value="#{filePathAction.filePathBean.backup}" required="true" onblur="checkPath(this.value)"> 
					</h:inputTextarea>
					<span class="help-inline" id="fbackupError" style="color:red"><h:message for="backup" style="color:red" /></span>
				</div>
			</div>
		</div>
		<div class="form-actions">
			<h:commandButton value="#{messages['btn_submit']}" styleClass="btn btn-primary" action="#{filePathAction.edit}" />
			<h:outputText value=" "></h:outputText>
			<a4j:commandButton value="#{messages['btn_cancel']}" action="main" ajaxSingle="true" styleClass="btn" />
		</div>
	</h:form>
	<script src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
	<script src="<%=request.getContextPath()%>/js/bootstrap.js"></script>
	<script type="text/javascript">
	$(document).ready(function() {
		//document.getElementById('viewDiv').scrollIntoView();
	});
	</script>
</body>
</f:view>
</html>
